<template>
  <div>
        <el-row>
      <el-col :span="3">
      <span class="demonstration" ></span>
      <el-dropdown trigger="click">
        <span class="el-dropdown-link">
    <el-button type="primary" style="padding-right:30px" icon="el-icon-apple">
      选择可签约团队<i class="el-icon-arrow-down el-icon--right"></i>
    </el-button>
    </span>
    <el-dropdown-menu slot="dropdown">
      <div v-for="item in options"
          :key="item.depname"       
          :value="item.depname" >
      <el-dropdown-item  @click.native="selSignPackage(item.depname)" icon="el-icon-money">
     {{item.depname}}
      </el-dropdown-item>
      </div>
    </el-dropdown-menu>
  </el-dropdown>
    </el-col>
  </el-row>
      <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="otid" label="团队套餐id" width="150">
      </el-table-column>
      <el-table-column prop="otname" label="团队套餐" width="180">
      </el-table-column>
      <el-table-column prop="otprice" label="套餐价格" width="180">
      </el-table-column>
      <el-table-column prop="otText" label="套餐描述" width="400">
      </el-table-column>
      <el-table-column label="操作" width="200">
        <template slot-scope="scope">
          <el-button @click="selSignDoc(scope.row)">选择医生</el-button>
        </template >
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  mounted() {
    // this.updateTable();
    this.selSignTeam()
  },
  data() {
    return {
      tableData: [],
      options:[],
      formLabelWidth: "120px",
    };
  },
  methods: {
    selSignDoc(e) {
      let info = JSON.stringify(e.otid);
       sessionStorage.setItem("otid", info);
       this.$router.push("/Pat_selDoc");
    },
    updateTable() {
          let dhospital=JSON.parse(sessionStorage.getItem("dhospital"));
          this.$axios.post("patient-serv/patientinfo/selAllSignPackage/"+dhospital).then((response) => {
          let r = response.data;
          this.tableData=r.data;
        });
    },
    selSignTeam() {
      let dhospital=JSON.parse(sessionStorage.getItem("dhospital"));
      this.$axios.post("patient-serv/patientinfo/selSignTeam/"+dhospital).then((response) => {
      console.log(response);
      let r=response.data;
      this.options=r.data;
      });
    },
    selSignPackage(depname) {
      let info = JSON.stringify(depname);
      sessionStorage.setItem("depname", info);
      this.$axios.post("patient-serv/patientinfo/selSignPackage/"+depname).then((response) => {
      let r=response.data;
      this.tableData=r.data;
      });
    },
  }
};
</script>

<style>

</style>